from openpyxl import Workbook

wb = Workbook()
ws = wb.active

# 直接对A1进行赋值
ws['A1'] = "Java"

# 通过工作表坐标获取到cell进行赋值
cell = ws["B1"]
cell.value = "C++"

# 通过Worksheet.cell()函数进行赋值
ws.cell(row=1, column=3, value="Python")

# 保存文件  是wb 整个工作簿的报错 不是ws
wb.save("./write.xlsx")